"""
<form class="log-form" id="bsp-form-login" method="post" onsubmit="return false;" autocomplete="off">
            <input type="hidden" id="csrf" name="csrf" value="7df02ca3cbc3420c8436c08bd3e552e4">
            <input type="hidden" id="client_id" name="client_id" value="dgov-portal">
            <input type="hidden" id="redirect_uri" name="redirect_uri" value="https://gzmh.zwfw.guizhou.gov.cn/login/callback.html">
            <input type="hidden" id="response_type" name="response_type" value="code">
            <input type="hidden" id="scope" name="scope" value="read">
            <input type="hidden" id="state" name="state" value="3ybda">
            <input type="hidden" id="busi_uri" name="busi_uri" value="">
            <input type="hidden" id="is_weak_pwd" name="is_weak_pwd">
            <div class="form-group account">

"""

'''
/ucenter/simpleLogin?=&response_type=code&client_id=dgov
'''
from 运维工具.登录逻辑.utils.slice_str import slice_between
from 运维工具.登录逻辑.utils.解构set_cookies import parse_cookie_to_simple_kv
import requests
def getUUID(**kwargs):


    cookies = {
        'tempTokenKey': kwargs.get('tempTokenKey'),
    }

    headers = {
        'Host': 'gzmh.zwfw.guizhou.gov.cn',
        'sec-ch-ua': '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"Windows"',
        'Upgrade-Insecure-Requests': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0',
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
        'Sec-Fetch-Site': 'same-origin',
        'Sec-Fetch-Mode': 'navigate',
        'Sec-Fetch-Dest': 'iframe',
        'Referer': 'https://gzmh.zwfw.guizhou.gov.cn/login/',
        'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    }

    response = requests.get(
        'https://gzmh.zwfw.guizhou.gov.cn/ucenter/simpleLogin?=&response_type=code&client_id=dgov-portal&redirect_uri=https://gzmh.zwfw.guizhou.gov.cn/login/callback.html&version=guizhou&isHLW=true',
        cookies=cookies,
        headers=headers,
    )
    response_text = response.text
    # print(response.headers)
    Set_Cookie=parse_cookie_to_simple_kv(response.headers['Set-Cookie'])
    datas={
        "csrf":slice_between(response_text,'name="csrf" value="','"'),
        "state":slice_between(response_text,'name="state" value="','"'),
        "JSESSIONID":Set_Cookie['JSESSIONID']
    }



    return datas


